package day0320;

import java.util.Arrays;
import java.util.Random;

public class Test8 {
    public static void main(String[] args) {
        //1.定义一个存储了四个数的数组nums
        int[]  nums={5,6,7,3,4,60,70};
        Random r=new Random();
        //2.打乱数组次序
        for (int i = 0; i < nums.length-1 ; i++) {
            int beChangeIndex=r.nextInt(7-(i+1)+i+1);
            int t=nums[i];
            nums[i]= nums[ beChangeIndex ];
            nums[ beChangeIndex ]=t;
        }
        //3.打印数组
        System.out.println(Arrays.toString(nums));
    }
}





//(int)(Math.random()*nums.length-1-(i+1)) + (i+1)
//(int)(Math.random()*nums.length-1-(i+1)) + (i+1)